package com.yidu.t299.dao.ssk;
import com.yidu.t299.domain.ssk.AwardPenalize;
import org.apache.ibatis.annotations.*;
import java.util.List;

/**
 * @author 粟术康
 * @version 1.0
 * @description
 * @date:2023/3/9 9:01
 */
@Mapper
public interface AwardPenalizeMapper {
    /**
     * 添加惩罚信息
     * @param awardPenalize 惩罚对象
     * @return 影响的行数(返回1则为成功)
     */
    @Insert({"insert into award_penalize (award_penalize_id,comport,award_penalize_money)" +
            " values (#{awardPenalizeId,jdbcType=INTEGER}, " +
            "#{comport,jdbcType=VARCHAR}," +
            "#{awardPenalizeMoney,jdbcType=VARCHAR})"
    })
    int insert(AwardPenalize awardPenalize);
    /**
     * 根据账户编号删除该惩罚信息
     * @param awardPenalizeId 惩罚编号
     * @return 影响的行数(返回1则为成功)
     */
    @Delete({"delete from award_penalize" +
            " where award_penalize_id = #{awardPenalizeId,jdbcType=INTEGER}"})
    int deleteByPrimaryKey(Integer awardPenalizeId);
    /**
     * 根据惩罚信息修改其数据
     * @param awardPenalize 惩罚对象
     * @return 影响的行数(返回1则为成功)
     */
    @Update({
            "update award_penalize" +
                    " set comport = #{comport,jdbcType=VARCHAR}," +
                    " award_penalize_money = #{awardPenalizeMoney,jdbcType=VARCHAR}"+
                    " where award_penalize_id = #{awardPenalizeId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(AwardPenalize awardPenalize);
    /**
     * 根据惩罚编号查询指定的信息
     * @param awardPenalizeId 惩罚编号
     * @return 惩罚对象
     */
    @Select({
            "select" +
                    " award_penalize_id,comport,award_penalize_money" +
            " from award_penalize" +
            " where award_penalize_id = #{awardPenalizeId,jdbcType=INTEGER}"
    })
    @Results(id = "AwardPenalizeMap",value = {
            @Result(id = true,column = "award_penalize_id",property = "awardPenalizeId" ),
            @Result(column = "comport",property = "comport"),
            @Result(column = "award_penalize_money",property = "awardPenalizeMoney")
    })

    AwardPenalize selectByPrimaryKey(Integer awardPenalizeId);

    /**
     * 按条件分页查询惩罚数据集合
     * @param rows 每页的行数
     * @param page 页码
     * @param condition 条件参数
     * @return 惩罚对象集合
     */
    @Select("select * from award_penalize where 1=1 ${condition} limit #{page},#{rows}")
    @ResultMap("AwardPenalizeMap")
    List<AwardPenalize> selectByPage(@Param("rows") int rows, @Param("page") int page, @Param("condition") String condition);

    /**
     * 按条件查询awardPenalize表中数据行数
     * @param condition 条件参数
     * @return 数据行数
     */
    @Select("select count(*) from award_penalize where 1=1 ${condition}")
    int selectCount(@Param("condition") String condition);
}
